Tcl Source Code

Check-in [96910cd882]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:amend to [ae09f6b190]: fixes SF [a7b7dd7927f3d56b] - LoadCleanupProc can be invoked with NULL first pointer (empty list on interp deletion if unloaded earlier)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | core-8-branch
Files: files | file ages | folders
SHA3-256: 96910cd8822ffb8f0e1fd4bd9906372fabe86a759cb8f2e85700284be7155fb2
User & Date: sebres 2024-07-16 14:54:06.993
References
2024-07-16
15:10 Closed ticket [a7b7dd7927]: segfault after unload-4.6 plus 6 other changes artifact: 7071633da4 user: sebres
Context
2024-07-16
17:42
clock: fixed regression [3ee8f1c2a785f4d8]: time overflow (without validation) must cause day increm... check-in: 70997824b1 user: sebres tags: core-8-branch
15:06
merge 8.7 check-in: 5d148bf304 user: sebres tags: trunk, main
14:54
amend to [ae09f6b190]: fixes SF [a7b7dd7927f3d56b] - LoadCleanupProc can be invoked with NULL first ... check-in: 96910cd882 user: sebres tags: core-8-branch
2024-07-15
01:16
fixes memory leak [ae09f6b190ceec31]: properly unload and free InterpLibrary if interpreter gets del... check-in: 24ace090aa user: sebres tags: core-8-branch
Changes
Unified Diff Ignore Whitespace Patch
Changes to generic/tclLoad.c.
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226

1227
1228
1229
1230
1231
1232
1233
    ClientData clientData,	/* Pointer to first InterpLibrary structure
				 * for interp. */
    Tcl_Interp *interp)
{
    InterpLibrary *ipPtr = (InterpLibrary *)clientData, *nextPtr;
    LoadedLibrary *libraryPtr;

    do {
	libraryPtr = ipPtr->libraryPtr;
	UnloadLibrary(interp, interp, libraryPtr, 0, "", 1);
	/* UnloadLibrary doesn't free it by interp delete, so do it here and
	 * repeat for next. */
	nextPtr = ipPtr->nextPtr;
	ckfree(ipPtr);
	ipPtr = nextPtr;
    } while (ipPtr);

}

/*
 *----------------------------------------------------------------------
 *
 * TclFinalizeLoad --
 *







|







<
>







1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225

1226
1227
1228
1229
1230
1231
1232
1233
    ClientData clientData,	/* Pointer to first InterpLibrary structure
				 * for interp. */
    Tcl_Interp *interp)
{
    InterpLibrary *ipPtr = (InterpLibrary *)clientData, *nextPtr;
    LoadedLibrary *libraryPtr;

    while (ipPtr) {
	libraryPtr = ipPtr->libraryPtr;
	UnloadLibrary(interp, interp, libraryPtr, 0, "", 1);
	/* UnloadLibrary doesn't free it by interp delete, so do it here and
	 * repeat for next. */
	nextPtr = ipPtr->nextPtr;
	ckfree(ipPtr);
	ipPtr = nextPtr;

    }
}

/*
 *----------------------------------------------------------------------
 *
 * TclFinalizeLoad --
 *